home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garden Fax: Indoor Plants
/
Garden Fax - Indoor Plants (1991)(CDTV Publishing)[!].iso
/
system
/
basicdemos
/
bitplanes
(
.txt
)
< prev
next >
Wrap
AmigaBASIC Source Code
|
1991-04-17
|
2KB
|
91 lines
REM << AmigaBasic >>
REM << Find Ptrs to BitPlanes >>
REM << Carolyn Scheppner CBM >>
depth = 5
x = 320
y = 200
SCREEN 2,x,y,depth,1
WINDOW 2,"Click Mouse to Exit",,7,2
GOSUB GetScrAddrs
PRINT
PRINT "STRUCTURE ADDRESSES:"
PRINT "Window -----"sWindow&
PRINT "Screen -----"sScreen&
PRINT "ViewPort ---"sViewPort&
PRINT "RastPort ---"sRastPort&
PRINT "BitMap -----"sBitMap&
PRINT "ColorMap ---"sColorMap&
PRINT "ColorTable -"colorTab&
PRINT
PRINT "OTHER VALUES:"
PRINT "Width ------"scrWidth%
PRINT "Height -----"scrHeight%
PRINT "Depth ------"scrDepth%
PRINT "Colors -----"nColors%
PRINT
PRINT "BITPLANE ADDRESSES:"
FOR k = 0 TO scrDepth%-1
PRINT "BitPlane" k "---"bPlane&(k)
NEXT
LOCATE 2,1
PRINT TAB(26)"RGB VALUES:":PRINT
FOR k = 0 TO (nColors%/2)-1
COLOR k: PRINT TAB(25)"* ";: COLOR 1
PRINT HEX$(PEEKW(colorTab&+(2*k)))
NEXT
LOCATE 4,1
FOR k = (nColors%/2) TO nColors%-1
COLOR k: PRINT TAB(33)"* ";: COLOR 1
PRINT HEX$(PEEKW(colorTab&+(2*k)))
NEXT
PRINT:PRINT:PRINT TAB(25)"Poking->"
REM << Test - Random Poke to the BitPlanes >>
bytesPerRow% = scrWidth% / 8
rowByte% = 33
FOR y = 178 TO 186
FOR k = 0 TO depth-1
POKE bPlane&(k)+(y*bytesPerRow%)+rowByte%, INT(255*RND)
NEXT
NEXT
WaitForClick:
SLEEP
IF MOUSE(0) = 0 THEN WaitForClick
Cleanup:
WINDOW CLOSE 2
SCREEN CLOSE 2
END
GetScrAddrs:
REM - Get addresses of screen structures
sWindow& = WINDOW(7)
sScreen& = PEEKL(sWindow& + 46)
sViewPort& = sScreen& + 44
sRastPort& = sScreen& + 84
sColorMap& = PEEKL(sViewPort& + 4)
colorTab& = PEEKL(sColorMap& + 4)
sBitMap& = PEEKL(sRastPort& + 4)
REM - Get screen parameters
scrWidth% = PEEKW(sScreen& + 12)
scrHeight% = PEEKW(sScreen& + 14)
scrDepth% = PEEK(sBitMap& + 5)
nColors% = 2^scrDepth%
REM - Get addresses of Bit Planes
FOR kk = 0 TO scrDepth% - 1
bPlane&(kk) = PEEKL(sBitMap&+8+(kk*4))
NEXT
RETURN